Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Incorrect configuration information read #39

Merged
merged 3 commits into from
Jun 11, 2022
Merged

fix: Incorrect configuration information read #39

merged 3 commits into from
Jun 11, 2022

Conversation

zhangyue0503
Copy link
Contributor

读取配置信息键名有问题

不过读对了也没用,think-migration 有问题,已经向那边提交了 issue 数据库迁移脚本向不同的连接库迁移问题

读取配置信息键名有问题
@hsluoyz
Copy link
Member

hsluoyz commented Jun 2, 2022

@leeqvip

@@ -29,7 +29,7 @@ protected function init()
*/
protected function getDbConfig(): array
{
$default = config('tauthz.database.connection') ?: config('database.default');
$default = config('tauthz.enforcers.basic.database.connection') ?: config('database.default');

$config = config("database.connections.{$default}");

Copy link
Member

@leeqvip leeqvip Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhangyue0503 First you should get the default enforcer, and then get the database.connection in it.

$default = config('tauthz.default');
$connection = config("tauthz.enforcers.{$default}.database.connection") ?: config('database.default');

$config = config("database.connections.{$connection}");

Copy link
Contributor Author

@zhangyue0503 zhangyue0503 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没毛病,还是要走配置文件,我给直接写死了

@leeqvip
Copy link
Member

leeqvip commented Jun 10, 2022

没毛病,还是要走配置文件,我给直接写死了

@zhangyue0503 You seem to have forgotten to modify the last line of code.

@leeqvip leeqvip changed the title 读取配置信息问题 fix: Incorrect configuration information read Jun 11, 2022
@leeqvip leeqvip merged commit 0043076 into php-casbin:master Jun 11, 2022
@leeqvip
Copy link
Member

leeqvip commented Jun 11, 2022

🎉 This PR is included in version 1.5.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants